package com.foreknow.dao.inpl;

import com.foreknow.db.JdbcTemplate;
import com.foreknow.mapping.MappingFactory;

import java.sql.Connection;

/**
 * 要将获取JdbcTemplate以及MappingFactory对象放到父类中,已达到可重用的目的
 */
public class BaseDao {
    public JdbcTemplate jdbcTemplate = JdbcTemplate.getInstance();
    public MappingFactory mappingFactory =MappingFactory.getInstance();

    /**
     * 注入数据库链接
     * @param connection
     */
    public void setConnection (Connection connection){
        jdbcTemplate.setConnection(connection);
    }
}
